package com.orkasgb.framework.hadoop.mapperreduce.join.reducejoin;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class JoinEntity implements Writable {
    //no	id	num	date
    //1	1	10	1/18/2022
    private int no;
    private String id;
    private int num;
    private String date;
    private String name;
    private String flag;

    public JoinEntity() {
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt(this.no);
        dataOutput.writeUTF(this.id);
        dataOutput.writeInt(this.num);
        dataOutput.writeUTF(this.date);
        dataOutput.writeUTF(this.name);
        dataOutput.writeUTF(this.flag);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        this.no = dataInput.readInt();
        this.id = dataInput.readUTF();
        this.num = dataInput.readInt();
        this.date = dataInput.readUTF();
        this.name = dataInput.readUTF();
        this.flag = dataInput.readUTF();
    }

    @Override
    public String toString() {
        return no + "\t" + name + "\t" +
                 num + "\t" + date;
    }

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getflag() {
        return flag;
    }

    public void setflag(String flag) {
        this.flag = flag;
    }
}
